package com.xy.lang.enums;

/**
 *
 * @param <E>   The enum type subclass
 */
public interface LongCodeEnum<E extends Enum<E>> {

    /**
     *
     * @return
     */
    long getCode();

    /**
     *
     * @param target
     * @return
     */
    default boolean equalsTo(Long target) {
        return null != target && target.equals(getCode());
    }

    /**
     *
     * @param target
     * @return
     */
    default boolean equalsTo(long target) {
        return getCode() == target;
    }

}
